package com.bjpowernode.controller;

import com.bjpowernode.result.NameValueData;
import com.bjpowernode.result.OverviewData;
import com.bjpowernode.result.R;
import com.bjpowernode.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StatisticController {
    @Resource
    private StatisticService statisticService;
    @GetMapping("/api/overview/data")
    public R loadOverviewData(){
        OverviewData overviewData= statisticService.loadOverviewData();
        return R.OK(overviewData);
    }

    @GetMapping("/api/funnel/data")
    public R loadfunneldata(){

        /**
         * data: [
         *    { value: 100, name: '线索' },
         *    { value: 80, name: '客户' },
         *    { value: 60, name: '交易' },
         *    { value: 20, name: '成交' },
         * ]
         */
        List<NameValueData> NameValueDataList = statisticService.loadFunnelData();

        return R.OK(NameValueDataList);
    }

    @GetMapping("/api/pie/data")
    public  R ClueSourcePie(){
        /**
         *  [
         *     { value: 1048, name: 'Search Engine' },
         *     { value: 735, name: 'Direct' },
         *     { value: 580, name: 'Email' },
         *     { value: 484, name: 'Union Ads' },
         *     { value: 300, name: 'Video Ads' }
         *  ]
         */
        List<NameValueData> NameValueDataList = statisticService.loadClueSourcePie();
        return  R.OK(NameValueDataList);
    }
    @GetMapping("/api/activity/bar/data")
    public  R ActivityBar(){

        return  null;
    }
    @GetMapping("/api/clue/bar/data")
    public  R ClueBar(){

        return  null;
    }
    @GetMapping("/api/customer/bar/data")
    public  R CustomerBar(){

        return  null;
    }
    @GetMapping("/api/tran/bar/data")
    public  R TranBar(){

        return  null;
    }
}
